<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
	<title>定时任务管理</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 样式文件的引入 -->
	<link href="/comm-schedule-server/commons/css/style.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="/comm-schedule-server/commons/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="/comm-schedule-server/commons/themes/icon.css">
	<!-- jqueryUI JS文件的引入 -->
	<script type="text/javascript" src="/comm-schedule-server/commons/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="/comm-schedule-server/commons/js/jquery.easyui.min.js"></script>
	<!-- 开发使用的公用js方法 -->
	<script type="text/javascript" src="/comm-schedule-server/commons/js/common.js"></script>
	<script type="text/javascript" src="/comm-schedule-server/commons/js/easyui-lang-zh_CN.js"></script>
	<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	<script type="text/javascript">var ctx = '/comm-schedule-server';var actionExt = "action";var i18n = new Object();</script>
	<script src="/comm-schedule-server/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
	<!--[if lt IE 9]>
	<?import namespace="v" implementation="#default#VML" ?>
	<![endif]-->
</head>
  <body>
    <div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'north',border:false">
		<div class="queryContent" style="height: 32px;">
			<form name="searchForm" id="searchForm" method="post" action="" style="display: none; ">
				<table class="queryTable" >
					<tbody>
						<tr>
							<th width="80%" style="text-align: right;">所属系统</th>
							<td width="10%">
								<input id="selSysCodeCombobox" class="easyui-combobox" style="width:200px" data-options="panelHeight:'auto',onSelect:function(sys){$('#sysCode').val(sys.value);$('#search').click();}"/>
								<input type="hidden" name="sysCode" id="sysCode"/>	
							</td>
						  	<td align="right" width="10%"><a href="javascript:void(0);" class="easyui-linkbutton" id="search"  plain="true">查询</a>
								<a href="javascript:void(0);" class="easyui-linkbutton" id="resetSearch" plain="true">清空</a>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
	
	<div data-options="region:'center',border:true">
			<table id="listTable" class="easyui-datagrid" 
				data-options="singleSelect:false,toolbar:'#tb',method:'post',rownumbers:true,fit:true,fitColumns:true,border:false,
					pagination:true,remoteSort:true,multiSort:true,striped:true,onLoadSuccess:function(data){$('#'+paramObj.searchID).attr('disabled',false);},
					url:'/comm-schedule-server/task/list'"}>
				<thead>
					<tr>
						<th data-options="field:'id',checkbox:true"></th>
						<th data-options="field:'code',width:30,sortable:true,align:'left',halign:'center',formatter: function(value,row,index){
							return '<a href=javascript:void(0); onclick=openDataDialog(paramObj,\''+row.id+'\');>'+value+'</a>';
						},title:'任务编码'"></th>
						<th data-options="field:'name',width:40,align:'center',title:'任务名称'"></th>
						<th data-options="field:'conf',width:40,align:'center',title:'任务配置'"></th>
						<th data-options="field:'proceedMethod',width:120,align:'left',title:'任务接口'"></th>
						<th data-options="field:'sysCodeName',width:40,align:'center',title:'所属系统'"></th>
						<th data-options="field:'statusName',width:40,align:'center',title:'任务状态',formatter: function(value,row,index){
							return '<a href=javascript:void(0) onclick=changeStatusDialog(\''+row.id+'\',\''+row.status+'\')>'+value+'</a>';
						}"></th>
						<th data-options="field:'status',width:40,align:'center',title:'执行日志',formatter: function(value,row,index){
							return '<a href=javascript:void(0) onclick=displayRecord(\''+row.code+'\')>查看日志</a>';
						}"></th>
						<th data-options="field:'remark',width:40,align:'left',title:'备注'"></th>
						<th data-options="field:'updaterName',sortable:true,width:40,align:'center',title:'更新人'"></th>
						<th data-options="field:'updateTime',width:60,align:'center',title:'更新时间'"></th>
					</tr>
				</thead>
			</table>
			<div id="tb" style="display: none;">
				<div>
					<a href="javascript:void(0);" onclick="openDataDialog(paramObj);" class="easyui-linkbutton" iconCls="icon-add" plain="true">添加</a>
					<a href="javascript:void(0);" onclick="updateData(paramObj);" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改</a>
					<a href="javascript:void(0);" onclick="deleteData(paramObj);" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
				</div>
			</div>
	</div>
	</div>
	<div id='firstLevelDialog'/>
	<div id='secondLevelDialog'/>
  </body>
  <script type="text/javascript">
		//初始化表格对应的js对象
		var paramObj;
		$(function() {
			//初始化表格对象数据
			paramObj = new initParams(
					{
						paramObjName : 'paramObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listTable',
						searchID:'search',
						resetSearchID:'resetSearch',
						searchFormID:'searchForm',
						showDialogId:'firstLevelDialog',
						addDialogTitle:'任务配置',
						addDialogWidth:820,
						addDialogHeight:288,
						updateUrl:'/comm-schedule-server/task/task-input.html',
						deleteUrl:'/comm-schedule-server/task/deleteTask'
					});
			//初始化查询
			init(paramObj);
			$.getJSON('/comm-dictionary-server/dictionary/findDictionaryByParentValue?sysCode=common&parentValue=sys_code',function(jsonData){
				$('#selSysCodeCombobox').combobox({
					data:jsonData.data,
					valueField:'value',
					textField:'name'
				});
			});
		});
		var taskId,taskStatus;
		function changeStatusDialog(id,status){
			taskId = id;
			taskStatus = status;
			$('#firstLevelDialog').dialog({    
			    title:'任务状态改变',  
			    iconCls:'icon-key',
			    width: 620,    
			    height: 200,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: '/comm-schedule-server/task/task-status-change.html',    
			    modal: true,
			    buttons : [{
						text:paramObj.cancelButton,
						iconCls:'icon-close',
						handler:function(){
							$('#'+paramObj.showDialogId).dialog('close');
						}}]
			});
		}
		
		var taskCode;
		function displayRecord(code){
			taskCode = code;
			$('#firstLevelDialog').dialog({    
			    title:'查看操作日志',  
			    iconCls:'icon-key',
			    width: 1120,    
			    height: 688,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: '/comm-schedule-server/task/display-task-record.html',    
			    modal: true,
			    buttons : [{
						text:paramObj.cancelButton,
						iconCls:'icon-close',
						handler:function(){
							$('#'+paramObj.showDialogId).dialog('close');
						}}]
			});
		}
	</script>
</html>
